import request from '@/utils/request'

export function getMenusTree() {
  return request({
    url: 'api/sysMenu/tree',
    method: 'get'
  })
}

export function buildMenus() {
  return request({
    url: 'api/sysMenu/build',
    method: 'get'
  })
}

export function add(data) {
  return request({
    url: 'api/sysMenu/addOrSave',
    method: 'post',
    data
  })
}

export function del(ids) {
  return request({
    url: 'api/sysMenu',
    method: 'delete',
    data: ids
  })
}

export function edit(data) {
  return request({
    url: 'api/sysMenu/addOrSave',
    method: 'post',
    data
  })
}

export function build(data) {
  return request({
    url: 'api/sysMenu/build',
    method: 'get',
    data
  })
}

export function copy(data) {
  return request({
    url: 'api/sysMenu/copy',
    method: 'post',
    data
  })
}

export function enableOrDisable(data) {
  return request({
    url: 'api/sysMenu/enableOrDisable',
    method: 'post',
    data
  })
}

export function exportDe(data) {
  return request({
    url: 'api/sysMenu/export',
    method: 'get',
    data
  })
}

export function importDe(data) {
  return request({
    url: 'api/sysMenu/import',
    method: 'get',
    data
  })
}

export function tree(data) {
  return request({
    url: 'api/sysMenu/tree' + '?' + data,
    method: 'get',
    data
  })
}
export function menu(data) {
  return request({
    url: 'api/sysRole/menu',
    method: 'get',
    data
  })
}

export function uploadImage(data) {
  return request({
    url: '/api/common/uploadImage',
    method: 'post',
    data
  })
}

export default { add, edit, del, getMenusTree, build, copy, exportDe, importDe, tree, enableOrDisable, menu }
